<script>
	let count = 1;
	let prd = {
		price: 10,
		count: count
	}
	let total = 0;
	let effect = () => {
		total = prd.price * prd.count;
	}
	effect();
	console.log(total);

	// 监听指定对象的属性变化
	Object.defineProperty(prd, 'count', {
		set(newVal) {
			count = newVal;
			effect();
		},
		get() {
			return count;
		}
	})
</script>